class DataController<ApplicationController
  protect_from_forgery :except => :safeindex
  skip_before_filter :verify_authenticity_token
  def safeindex
    user_id = session[:id]
    domain_login_id = session[:domain_login_id]

    if user_id==nil
      render :text => '请通过阿里平台登录后'
      return
    end
    data =  WWW::Lewei::Utils::Misc.parse_post_parameter request.raw_post.to_s
    #判定用户是否登录
    transfer_data = WWW::Lewei::Model::TransferData.new data["data"],true
    if transfer_data.validate
      #分页操作将开始与结束信息通过Parameter传递
      start = data["offset"]
      limit = data["limit"]
      if start!=nil && limit!=nil
        transfer_data.parameter["start"]=start
        transfer_data.parameter["limit"]=limit
      end
      transfer_data.parameter["domain_login_id"]=domain_login_id
      transfer_data.parameter["user_id"]=user_id
      result = WWW::Lewei::Utils::Misc.event_excute transfer_data
      render :text=>result.to_json
    else
      render :text=>WWW::Lewei::Utils::Misc::get_stand_result(false,"认证失败").to_json
    end
  end
end
